Working
with Palettes
Initially, if
the video capture format requires a palette, the capture window uses the
palette supplied by the capture driver. This palette might consist of
gray-scale values for black-and-white reproduction, or a broad selection of
color values. You can retrieve an existing palette to replace the default
palette by using the WM_CAP_PAL_PASTE
The
WM_CAP_PAL_AUTOCREATE or WM_CAP_PAL_MANUALCREATE message creates an optimized
palette based on the current video input. This custom palette gives a video
sequence the best color fidelity because it is based on colors that exist in
the sequence. The capture window creates a three-dimensional histogram of the
colors it samples. It reduces the number of colors by examining the absolute
error between adjacent colors and consolidating those with the smallest error
value.
When sending
WM_CAP_PAL_AUTOCREATE, you must specify the number of frames for AVICap to
sample, and specify the size of the color palette. When specifying the number
of frames, include enough frames to ensure that all colors in the sequence are
sampled.
You can
sample the current frame by using WM_CAP_PAL_MANUALCREATE. By using this
message with several manually selected frames, you can create a palette that contains
the colors you want to appear in the palette.
A palette can
contain up to 256 colors. If you merge palettes or if the video sequence is to
be displayed simultaneously with other video or images, you should use a
smaller color selection so that colors from each image or video clip can
coexist.
You save a
new palette by using the WM_CAP_PAL_SAVE
You can paste
a palette from the clipboard into the capture window by using the WM_CAP_PAL_PASTE